package easyjava.function;

import java.util.Map;
import java.util.function.BooleanSupplier;

import easyjava.function.EachFunction.AfterEachFun;
import easyjava.function.EachFunction.EachFun;
import easyjava.function.EachFunction.EachMapFun;
import easyjava.function.GenerateFunction.GenerateFun;
import easyjava.function.GenerateFunction.Generator;
import easyjava.function.WhenFunction.WhenFun;
import easyjava.function.WithFunction.WithCallHasReturn;
import easyjava.function.WithFunction.WithCallNoReturn;
import easyjava.struct.Pair;

public class AllFunction{

	private AllFunction() {}
	
	public static <T> T cast(Object obj) {
		return CastFunction.cast(obj);
	}

	public static <T> T castToObject(Object obj) {return CastFunction.castToObject(obj);}
	
	public static String str(Object... objs) {
		return CreateFunction.str(objs);
	}
	
	public static String re(String regex) {
		return CreateFunction.re(regex);
	}
	
	public static <T> T[] array(T... items) {
		return CreateFunction.array(items);
	}
	
	public static Pair pair(String key,Object value) {
		return CreateFunction.pair(key, value);
	}
	
	public static <T> Map<String,T> createMap(Pair... pairs) {
		return CreateFunction.createMap(pairs);
	}
	
	public static AfterEachFun each(Object obj,EachFun<Object> eachFun) {
		return EachFunction.each(obj, eachFun);
	}
	
	public static AfterEachFun each(Object obj,EachMapFun eachFun) {
		return EachFunction.each(obj, eachFun);
	}
	
	public static void pass(){
		ExtraFunction.pass();
	}
	
	public static <T> Generator<T> generator(final GenerateFun generateFun) {
		return GenerateFunction.generator(generateFun);
	}
	
	public static <T> Generator<T> generator(final GenerateFun generateFun,int end) {
		return GenerateFunction.generator(generateFun, end);
	}
	
	public static <T> Generator<T> generator(final GenerateFun generateFun,int start,int end) {
		return GenerateFunction.generator(generateFun, start, end);
	}
	
	public static <T> Generator<T> generator(final GenerateFun generateFun,int start,int end,int step) {
		return GenerateFunction.generator(generateFun, start, end, step);
	}
	
	public static String input(){
		return IOFunction.input();
	}
	
	public static String input(String format,Object... args){
		return IOFunction.input(format, args);
	}
	
	public static void print(Object obj) {
		IOFunction.print(obj);
	}
	
	public static void println(Object obj) {
		IOFunction.println(obj);
	}
	
	public static void printf(String format,Object... args) {
		IOFunction.printf(format, args);
	}
	
	public static Generator<Integer> range(int stop){
		return RangeFunction.range(stop);
	}
	
	public static Generator<Integer> range(int start,int stop){
		return RangeFunction.range(start, stop);
	}
	
	public static Generator<Integer> range(int start,int stop,int step){
		return RangeFunction.range(start, stop, step);
	}
	
	public static WhenFun when(boolean condition,Runnable action) {
		return WhenFunction.when(condition, action);
	}
	
	public static WhenFun when(BooleanSupplier boolFun,Runnable action) {
		return WhenFunction.when(boolFun, action);
	}
	
	public static <T> void with(T obj, WithCallNoReturn<T> callFun) {
		WithFunction.with(obj, callFun);
	}
	
	public static <T, E> E with(T obj, WithCallHasReturn<T> callFun) {
		return WithFunction.with(obj, callFun);
	}
	
	public static Runnable sequence(Runnable... actions) {
		return ExecFlowFunction.sequence(actions);
	}
	
	public static Runnable parallel(Runnable... actions) {
		return ExecFlowFunction.parallel(actions);
	}
	
	public static void choice(boolean condition,Runnable trueAction,Runnable falseAction) {
		ChoiceFunction.choice(condition, trueAction, falseAction);
	}
	
	public static void choice(double chance,Runnable action1,Runnable action2) {
		ChoiceFunction.choice(chance, action1, action2);
	}
}
